
import org.junit.Test
import com.mfz.common.encryption.rsa.getRsaClientByBase64
import com.mfz.common.encryption.rsa.getRsaServerByBase64
import com.mfz.common.encryption.simple.SimpleEncryptPublic
import com.mfz.common.encryption.simple.SimpleEncyrptPrivate


class TestRsa {
	@Test
		fun testSimple2(){
		val private = SimpleEncyrptPrivate("wdfYYuilJFK/0vJCuq3fW3PC7r78LGnwCgBKSN1Nm0y7mHxoy9ciqsa5mnqLYRQNUVHj6hpHG886t/qwhqVpQfDfev+OsuUYHxNDcefsmEaeLMRDtG9Jq+j4J/ehY2SnEJWvBtaFtXB/MV5aVIxQR7sPnVU4VugGci93")
println(private.encrypt("""{
	 ID: 999,
	"value": "content"
}
"""))

		println(private.decrypt("/YcdOIC6WMXa97ZMMzExFJaZ/TXqfKUx1U1z0MqRQ9WbWl2ePLfZZ7rw0FJFEz01Ovg1Kc8t4HkaP4wkSB1H+w=="))

	}
	@Test
	fun testSimple(){
		val public = SimpleEncryptPublic("YhrvikcFJIf9iEPkUhCoI/5P42RI9VMQUixAn2eqPblhieDabl0WmnqP+omaXvhF+xtLlmk4A+n6Oi1Z7NWwlYP3q/lPWb4lhUC7/inO2/Hpu4IHfHHAAFHWaIADkissiF7vU6VOcRYunfYd3rhOOef8F2COkfZImsqe")

		println(public.encrypt("""{TYPE:TEST,"requestPara":{ ID:999,"value":"content"}, ID:20}"""))


	}

	@Test
	fun testRas() {
		val pu = getRsaServerByBase64("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwtsWB83AXFHW+6IQRL/IeNWN5soZFovoupOghPGFkhDfROtZ4KAxyp7ekHwJKBjcsTlzUbezuzg9aMoZhb2oYVAApEydoyPDiF694PJU+S0c259goresYs6gSWpB58aNlWGAl6fDQiTup+n5rkVjPSMIhnM/1eh1/ZPWM/kpNZisAiGKm/Bo/IPgB3PRANRoFrmu/ET70M198UKn+TXcqM0wIxvRefjJBiZAUIgNTmRhDQerFtzySp1sY6t86krBub0X0h+NbcBYqFviOU2KohskJxA/kAWBv4ewYylSwk0HNeE07Nh2OwYkOiIodwDpH0V6yrJlaSoJEzxoBOLhlwIDAQAB")

		val pr  = getRsaClientByBase64("MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDC2xYHzcBcUdb7" +
			"ohBEv8h41Y3myhkWi+i6k6CE8YWSEN9E61ngoDHKnt6QfAkoGNyxOXNRt7O7OD1o" +
			"yhmFvahhUACkTJ2jI8OIXr3g8lT5LRzbn2Cit6xizqBJakHnxo2VYYCXp8NCJO6n" +
			"6fmuRWM9IwiGcz/V6HX9k9Yz+Sk1mKwCIYqb8Gj8g+AHc9EA1GgWua78RPvQzX3x" +
			"Qqf5NdyozTAjG9F5+MkGJkBQiA1OZGENB6sW3PJKnWxjq3zqSsG5vRfSH41twFio" +
			"W+I5TYqiGyQnED+QBYG/h7BjKVLCTQc14TTs2HY7BiQ6Iih3AOkfRXrKsmVpKgkT" +
			"PGgE4uGXAgMBAAECggEAEaMa/2HUQ4b02pn0twRU9Pr/eSBZ3PyU+C5cnSvvVyVH" +
			"0EktPXPCjgCLTLCtc3+smi4FDiR+lDem91EztjNQhl5jcHuu2RFnpXRN44qLvnIi" +
			"5o4qhQ/y/o6NW5fOl1gVgKvuo8t/lQEayQAYpXmKXgJJx0GvSYFdDLLQ9Ktc24jp" +
			"swyqehhmIwQVePNgiqtANTF4DSGAtea5MPNeBDttv+GgZ+J1E8wphnE0RBbmShXz" +
			"TOws28HzMSO0YoiYncdc4PSlAoH2K6SGTCD9tUOCR78PnwLnVjyEJ3wAyPsvC9UH" +
			"NBpgsvUWCY9BmG+ha1nno0CDmjVN7pMpCKKLLCJ1IQKBgQDny5wLSSobMQW8gmg9" +
			"4/XcuGrs88+OMpSQyoioK1w96/xff2ZPR58wDdPsij0KxZkyH7aFbS4bcdfnrhFN" +
			"lHK/u98xaYpaUxIoYr/P8YKetpXEs9ppnt4omp8ZnmZu3AGXtxKhQc22Q4+XZ26z" +
			"4UUCGv160gHVjq+qW1VqflDrzQKBgQDXNACvMYHDNC3ZExPL0UT1Vvwwvq58qXeg" +
			"sX3MYTUyiF19iuZ99Ne6WLM5euSKsQEnjYinpqCOjpdcvKMyr2+g9rk4GIe0rMae" +
			"CC/B6dVMcsyxh3iKHH0J6QBmOBMopWKbz4a7JCV2qQlQ76YVV0YLY+hqiPakDjfB" +
			"H1JexP1G8wKBgDuFmGt5fTuASiXPIu+Joy/rl2GDdi/goy/PImp0v/oSqDrpnx8K" +
			"mEEhu+LI2MX0WdN6O0dl8uoPQM74bu8KCLFdkAHDRUjOfiIqwXCnZtBUuH7LZHGs" +
			"3wV0NxjACTO8gRgxZbJNEIMWNEA/yjicxzi0L5Ujal8phchsLbHr/+GdAoGAA3bb" +
			"1/YlD55kao0rEWniAU0QLDy1lF4qBdU1oDekYpbdYmr9AOQTIPXSlMdMrIri6N8X" +
			"ZxOAnCrhduW2ftdiJaYzHxsN/DOX0u1wz19TRrLGZsk2gIqq3KD6l6qpbEsVRkrV" +
			"8WdIjxtzgfEJrGhGQWKvWB+yULvF2/8EFXB4X08CgYB0MFNSjo90LTiIa78QfI2y" +
			"F0PWRKqOu8vgsUkSXIwbPWWs6Df6UpAJ/WHfDacPlUXXfQB3TdlLV+0PxKYVirbL" +
			"5QCsJZ1dWKPUDfq6ZGqs5vbk4AVFal/AD9M/Ovw6YoE4KypKthMjGpqOCVzJefBp" +
			"4lqIFqa/EZUGrA2EJh9BJw==")


		println(pr.decrypt(pu.encrypt("1234fafsedfqsefrqw")))
		println(pu.decrypt(pr.encrypt("1234fafsedfqsefrqw")))

	}
}

